builder exception

by: Sri Syron, 6 years ago


in kivy with pyton tutorial 10, I tried to run the code in my computer but it is giving some errors i have tried to solve it but it is still showing that error. here is the code:

import kivy
kivy.require('1.10.0')
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition

class MainScreen(Screen):
    pass

class AnotherScreen(Screen):
    pass

class ScreenManagement(ScreenManager):
    pass

presentation = Builder.load_file("main.kv")

class MainApp(App):
    def build(self):
        return presentation

MainApp().run()



kivy code:


ScreenManagement:
    transition: FadeTransition()
    MainScreen:
    AnotherScreen:

<MainScreen>:
    name: 'main'

    Button:
        on_release: app.root.current = 'other'
        text: 'Another Screen'
        font_size: 50
            
<AnotherScreen>:
    name: 'other'

    Button:
        on_release: app.root.current = 'main'
        text: 'back to the home screen'
        font_size: 50


error:
transition: FadeTransition()
NameError: name 'FadeTransition' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
   File "C:UsersHPAppDataLocalProgramsPythonPython36-32libsite-packageskivylangbuilder.py", line 597, in _apply_rule
     rctx['ids'])
   File "C:UsersHPAppDataLocalProgramsPythonPython36-32libsite-packageskivylangbuilder.py", line 254, in create_handler
     cause=tb)
kivy.lang.builder.BuilderException: Parser: File "F:main.kv", line 2:
...
       1:ScreenManagement:
>>    2:    transition: FadeTransition()
       3:    MainScreen:
       4:    AnotherScreen:



You must be logged in to post. Please login or register an account.